package com.mstanford.movie.controller;

import java.io.IOException;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mstanford.movie.dao.MovieDao;

public class SingleMovieServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void service(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		
		String movieId = request.getParameter("movieId");
		
		MovieDao dao = new MovieDao();
		Map<String, String> map = dao.querySingleMovieDetails(movieId);

		request.setAttribute("movie", map);

		request.getRequestDispatcher("oneMovie.jsp").forward(request, response);
	}
}